package matrix;

public class Solution_48 {
    public void rotate(int[][] matrix) {
        int m = matrix.length;
        for (int i = 0; i < m; i++) {
            for (int j = i + 1; j < m; j++) {
                int tmp = matrix[i][j];
                matrix[i][j] = matrix[j][i];
                matrix[j][i] = tmp;
            }
        }
        int index = m / 2;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < index; j++) {
                int tmp = matrix[i][j];
                matrix[i][j] = matrix[i][m - 1 - j];
                matrix[i][m - 1 - j] = tmp;
            }
        }
    }
}
